gdk: add accessor for GdkEventOwnerChange::reason
authorMarc-Antoine Perennou <Marc-Antoine@Perennou.com>
Thu, 19 Oct 2017 12:22:23 +0000 (14:22 +0200)
committerMarc-Antoine Perennou <Marc-Antoine@Perennou.com>
Thu, 19 Oct 2017 12:37:28 +0000 (14:37 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=789198

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
gdk/gdkevents.c
gdk/gdkevents.h

index 65bd8210ae7f1969aebc6fef1a9b64bb48e2828c..63d17ea66689500a91318c3bfd91b3917e88c299 100644 (file)
@@ -3004,6 +3004,29 @@ gdk_event_get_selection (const GdkEvent   *event,
   return FALSE;
 }
 
+/**
+ * gdk_event_get_owner_change_reason:
+ * @event: a #GdkEvent
+ * @reason: (out):
+ *
+ * Returns: %TRUE on success, otherwise %FALSE
+ **/
+gboolean
+gdk_event_get_owner_change_reason (const GdkEvent *event,
+                                   GdkOwnerChange *reason)
+{
+  if (!event)
+    return FALSE;
+
+  if (event->type == GDK_OWNER_CHANGE)
+    {
+      *reason = event->owner_change.reason;
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
 /**
  * gdk_event_get_selection_property:
  * @event: a #GdkEvent
index 61cf64a5a47b8d8483be3aa2ff81d3704cd322f4..39bb46fdad83f6244a68d1efdea2fd22e0234555 100644 (file)
@@ -791,6 +791,9 @@ gboolean       gdk_event_get_property (const GdkEvent   *event,
 GDK_AVAILABLE_IN_3_92
 gboolean       gdk_event_get_selection (const GdkEvent   *event,
                                         GdkAtom          *selection);
+GDK_AVAILABLE_IN_3_94
+gboolean       gdk_event_get_owner_change_reason (const GdkEvent *event,
+                                                  GdkOwnerChange *reason);
 GDK_AVAILABLE_IN_3_92
 gboolean       gdk_event_get_selection_property (const GdkEvent  *event,
                                                  GdkAtom         *property,